<?php

use yii\helpers\Html;
use yii\widgets\LinkPager;

/* @var $this yii\web\View */

$this->title = '我的提问';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
    <a href="/user" class="btn btn-default" role="button">个人中心</a>
    <a href="/user/qa" class="btn btn-success" role="button">我的提问</a>
    <a href="/user/article" class="btn btn-default" role="button">我的文章</a>
    <a href="/user/comment" class="btn btn-default" role="button">我的回答</a>
</div>
<table class="table">
    <h3>我的提问</h3>
    <tbody>
        <?php foreach ($qa_list as $row): ?>
            <tr>
                <td class="w50"><div class="<?php echo $row->comments ? 'answers' : 'no-answers' ?>"><?php echo $row->comments; ?><small>回答</small></div></td>
                <td class="w50"><div class="views"><?php echo $row['view']; ?><small>浏览</small></div></td>
                <td>
                    <span><?php echo $row->author->username ?> &nbsp;&nbsp;<?php echo Yii::$app->formatter->asRelativeTime($row->created_at) ?>&nbsp;发布</span><br>
                    <a href="/qa/view?id=<?php echo $row['id'] ?>"><?php echo $row['title']; ?></a>
                    <?php foreach ($row->tags($row['id']) as $item): ?>
                        <a class="btn btn-success btn-xs" href="/tags/show?id=<?php echo $item->id ?>" role="button"><?php echo $item->name ?></a>
                    <?php endforeach; ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php
echo LinkPager::widget(['pagination' => $pages]); // 显示分页?>